#include <stddef.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#ifdef WIN32
#include <io.h>
#endif
#include "n2base.h"
#include "n2x86asm.h"



int PreProcessSourceFile(TPreproedSrc * SrcPieces, int argc, wchar_t **argv)
{
    size_t srclength;
    FILE* fpsrc = _wfopen(argv[1], L"rb");
    if ( fpsrc == NULL)
    {
        n2print("open file error. \n");
        exit(1);
    }
#if defined(__BORLANDC__)
    srclength = filelength(_fileno(fpsrc));
#else
    srclength = _filelength(_fileno(fpsrc));
#endif
    size_t block;
    for (block = 0; block < srclength/64; block++)
    {
        unsigned char* pbBuff = SrcPieces->NewPart(64);
        fread(pbBuff, 1, 64, fpsrc);
    }
    if (srclength%64)
    {
        unsigned char* pbBuff = SrcPieces->NewPart(srclength%64);
        fread(pbBuff, 1, srclength%64, fpsrc);
    }

    fclose(fpsrc);
    return 0;
}





